import os

result = os.popen('wmic process where name="python.exe" list brief')
data = result.read().split('\n')
pid = [d.split() for d in data if len(d) != 0 and data.index(d) != 0][-1][3]
print('result:', data)
print('pid:', pid)
print('try to kill %s...' % pid)
result = os.popen("taskkill.exe /f /pid %s" % pid)
print('result:', result.read())
